<?php defined('IN_IA') or exit('Access Denied');?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<avalon ms-skip="" class="avalonHide">
<style id="avalonStyle">
.avalonHide{ display: none!important }
</style>
</avalon>
<title>收货地址</title>
    <meta charset="utf-8">   
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="Pragma" content="no-cache">   
    <meta http-equiv="Cache-Control" content="no-store">
    <meta http-equiv="Expires" content="0">
<LINK href="../addons/feng_fightgroups/template/css/style_366c9ef.css" rel="stylesheet"> 
<LINK href="../addons/feng_fightgroups/template/css/my.css" rel="stylesheet">  
<LINK  href="../addons/feng_fightgroups/template/css/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../addons/feng_fightgroups/template/js/jquery.min.js"></script>
</head> 
<body  onload="cascdeInit('<?php  echo $addres['province'];?>','<?php  echo $addres['city'];?>','<?php  echo $addres['county'];?>')">
<div class="mod_container">
  <div class="wx_bar">
    <div class="wx_bar_back">         
     </div>
    <div ><b>收货地址：</b></div>

  </div>
  <div class="wx_wrap">
    <div class="address_new"><INPUT id="address_regionId" type="hidden">             
      <INPUT id="adid" type="hidden">                 
      <p>
        <LABEL for="name"><SPAN class="tit">收货人</SPAN>                         
        <INPUT name="name" id="name" type="text" placeholder="名字" value="<?php  echo $addres['cname'];?>">              
        
        </LABEL>                 
      </p>
      <p>
        <LABEL for="mobile"><SPAN class="tit">手机号码</SPAN>                         
              
        <input required="" id="mobile" placeholder="手机号码" name="mobile" maxlength="11" minlength="11" class="block input" tabindex="2" type="tel" value="<?php  echo $addres['tel'];?>" nkeyup="this.value=this.value.replace(/\D/gi,&quot;&quot;)" onblur="value=value.replace(/\D/gi,&quot;&quot;);if(value.length&lt;11){alert(&quot;电话号码位数不够！&quot;);this.focus();}">
        </LABEL> 
      </p>

      <p>
        <LABEL for="provinceId">
        <SPAN class="tit">省</SPAN>                         
        <SELECT name="provinceId" id="sel-provance" value="<?php  echo $addres['province'];?>"  onchange="selectCity();">
         <option value="" selected="selected"><?php  echo $addres['province'];?></option>
        </SELECT> 
        
        </LABEL>      
      </p>
      <p>
        <LABEL for="cityId">
        <SPAN class="tit">市</SPAN>                         
        <select class="select" id="sel-city" name="city" tabindex="4" required="required" onchange="selectcounty()">
              <option value="" selected="selected"><?php  echo $addres['city'];?></option>
            </select>
                          
        </LABEL>                 
      </p>
      <p id="areaSelP">
        <LABEL for="areaId"><SPAN class="tit">区/县</SPAN>                
                <select class="select" id="sel-area" name="area" tabindex="5" required="required">
              <option value="" selected="selected"><?php  echo $addres['county'];?></option>
            </select>
          </LABEL>  
      </p>
      <p><LABEL for="adinfo">
        <SPAN class="tit">详细地址</SPAN>                         
        <INPUT name="adinfo" id="address" type="text" placeholder="详细地址" value="<?php  echo $addres['detailed_address'];?>">        
                              
         </LABEL>   
       </p>
      <p class="action">
        <BUTTON class="submit" id="add">确认</BUTTON>
        <BUTTON class="submit" id="moren" style="background-color: #FFCC33;">设为默认地址</BUTTON>
        <BUTTON class="submit" id="deletes" style="background-color: red;">删除</BUTTON>           
      </p>
    </div>
  </div>
</div>
<div style="height:100px;"></div>
<?php  if($this->module['config']['mode'] == 1) { ?>
<footer class="footer">
    <nav>
      <ul>
        <li><a class="nav-controller" href="<?php  echo $this->createMobileUrl('index');?>"><i class="fa fa-home"></i>首页</a></li>
        <li><a href="<?php  echo $this->createMobileUrl('mygroup',array('op'=>0));?>" class="nav-controller"><i class="fa fa-group"></i>我的团</a></li>
        <li><a class="nav-controller" href="<?php  echo $this->createMobileUrl('myorder');?>"><i class="fa fa-list"></i>我的订单</a></li>
        <li><a class="nav-controller active" href="<?php  echo $this->createMobileUrl('person');?>">
        <i class="fa fa-user"></i>个人中心</a></li>
      </ul>
  </nav>
  </footer>
 <?php  } else { ?>
        <?php (!empty($this) && $this instanceof WeModuleSite) ? (include $this->template('footerbar', TEMPLATE_INCLUDEPATH)) : (include template('footerbar', TEMPLATE_INCLUDEPATH));?>
        <?php  } ?>
<input type="hidden" id='addresschange' name='addres' value='<?php  echo $addresschange;?>'>
<input type="hidden" id='con' name='conf' value='<?php  echo $con;?>'>
<input type="hidden" id='g_id' name='g' value='<?php  echo $all['g_id'];?>'>
<input type="hidden" id='groupnum' name='group' value='<?php  echo $all['groupnum'];?>'>

<script src="../addons/feng_fightgroups/template/js/cascade.js"></script>
<script>

       /*var pcas = new PCAS("province,<?php  echo $addres['province'];?>","city,<?php  echo $addres['city'];?>","area,<?php  echo $addres['county'];?>");*/
      
//    var pcas =  new PCAS("province=<?php  echo $addres['province'];?>,请选择省份","city=<?php  echo $addres['city'];?>,请选择城市","area=<?php  echo $addres['county'];?>,请选择地区");
//    // pcas.SetValue("", "", "");
      
      $("#add").bind("click", function() {
        var addresschange = $("#addresschange").val();
        var con = $("#con").val();
        var g_id = $("#g_id").val();
        var groupnum = $("#groupnum").val();
        var lxr_val=$("#name").val(); 
        if(!lxr_val){
            alert("请填写收货人姓名;");
            return false;
          };
        var mobile_val=$("#mobile").val(); 
        if(!mobile_val){
            alert("请填写手机号码;");
            return false;
          };
        var province_val=$("#sel-provance").val(); 
        if(!province_val){
            alert("请选择省份;");
            return false;
          };
        var city_val=$("#sel-city").val(); 
        if(!city_val){
            alert("请选择城市;");
            return false;
          };
        var area_val=$("#sel-area").val(); 
        if(!area_val){
            alert("请选择地区;");
            return false;
          };
        var address_val=$("#address").val(); 
        if(!address_val){
            alert("请填写详细地址;");
            return false;       
          };
        var message=confirm('请确认您的信息');
        if (message) {
            $.post('<?php  echo $this->createMobileUrl('createadd',array('op'=>'post','id'=>$addres['id']))?>',{lxr_val:lxr_val,mobile_val:mobile_val,province_val:province_val,city_val:city_val,address_val:address_val,area_val:area_val},function(m){
                if(m==1){
                
                  if(con == 1){
                    alert('添加成功');
                    location.href='<?php  echo $this->createMobileUrl('orderconfirm',array('groupnum'=> $groupnum,'id'=>$all['g_id'],'cao'=>'cao','tuan_id'=>$tuan_id));?>';
                  } 
                  if(addresschange == 1){
                    alert('修改成功');
                     location.href='<?php  echo $this->createMobileUrl('orderconfirm',array('groupnum'=> $all['groupnum'],'id'=>$all['g_id'],'tuan_id'=>$tuan_id));?>';
                  }
                  if(con != 1 && addresschange != 1){ 
                    alert('添加成功');                 
                    location.href='<?php  echo $this->createMobileUrl('addmanage');?>';
                  } 
                } else {
                    alert('添加失败！');
                }
               

             },"html");
          };
      
      });
 $("#deletes").bind("click", function() {
     $.post('<?php  echo $this->createMobileUrl('createadd',array('op'=>'deletes','id'=>$addres['id']))?>',function(m){
                if(m==1){
                alert('删除成功');
                location.href='<?php  echo $this->createMobileUrl('addmanage');?>';
                } 
                if(m==0){
                  alert('删除成功');
                }
                if(m==2){
                    alert('请先填写地址！');
                }
             },"html");
          

  });
 $("#moren").bind("click", function() { 
        var addresschange = $("#addresschange").val();
        var g_id = $("#g_id").val();
        var groupnum = $("#groupnum").val();
     $.post('<?php  echo $this->createMobileUrl('createadd',array('op'=>'moren','id'=>$addres['id']))?>',function(m){
                if(m==1){
                alert('设置默认成功'); 
                  if(addresschange == 1){
                     location.href='<?php  echo $this->createMobileUrl('orderconfirm',array('groupnum'=> $all['groupnum'],'id'=>$all['g_id'],'tuan_id'=>$tuan_id));?>';                   
                  }
                  if(addresschange != 1){
                    location.href='<?php  echo $this->createMobileUrl('addmanage');?>';
                  }
                // location.href='<?php  echo $this->createMobileUrl('addmanage');?>';
                }
                if(m==2){
                    alert('请先填写地址！');
                }
                if(m==0){
                   alert('设置默认失败'); 
                }
             },"html");
          

  });
    </script>
 </BODY>
 </HTML>
 